import { Body, Controller, Get, Post, Query } from '@nestjs/common';
import { MenuService } from './menu.service';
import { CreateMenuDto } from './dto/create.menu.dto';

@Controller('menu')
export class MenuController {
  constructor(private readonly menuService: MenuService) { }

  @Get()
  findAllTrees(@Query() menu) {
    return this.menuService.findAllTrees(menu);
  }

  @Post("save")
  create(@Body() createMenuDto: CreateMenuDto) {
    return this.menuService.create(createMenuDto);
  }

  @Post("update")
  update(@Body() data: any) {
    return this.menuService.update(data)
  }

  @Post("addPermission")
  addPermission(@Body() per) {
    return this.menuService.addPermission(per)
  }

  @Post("updatePermission")
  updatePermission(@Body() per) {
    return this.menuService.updatePermission(per)
  }

  @Get("findPermission")
  findPermission(@Query() id) {
    return this.menuService.findPermission(id)
  }

  @Get("remove")
  remove(@Query() data) {
    return this.menuService.remove(data)
  }
}
